<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright (c) 2023, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Welcome to WildFly Application Server</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="normalize.min.css">
    <link rel="stylesheet" href="wildfly.css">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
    <script>
        (() => {
            "use script";
            window.addEventListener("load", () => {
                const button = document.querySelector("button[type='submit']");
                button.addEventListener("click", (event) => {
                    event.preventDefault();
                    let name = document.querySelector('#nameInput');
                    name = encodeURIComponent(name.value);
                    const result = document.querySelector('#result');
                    fetch(`/hello/${name}`)
                        .then(response => {
                            if (response.status === 200) {
                                response.text().then(content => result.textContent = content);
                            } else {
                                result.textContent = `Unexpected response ${response.status}`;
                            }
                        });
                });
            });
        })();
    </script>
</head>
<body>
<div class="wrapper">
    <div class="content">
        <div class="logo">
            <img src="wildfly_logo.png" alt="Logo" title="Logo"/>
        </div>
        <h1>Getting Started</h1>
        <div id="interactive">
            <form name="nameForm">
                <label for="nameInput">Name: </label>
                <input type="text" id="nameInput">
                <button type="submit">Say Hello</button>
            </form>
            <p id="result">
            </p>
        </div>
    </div>
</div>
<footer>
  <p>This page is served by your application. The source is in <code>src/main/webapp/index.html</code>.</p>
</footer>
</body>
</html>
